from datetime import datetime
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()

class APIStats(db.Model):
    __tablename__ = 'api_stats'
    
    id = db.Column(db.Integer, primary_key=True)
    api_name = db.Column(db.String(50), nullable=False)  # 接口名称
    call_count = db.Column(db.Integer, default=0)        # 调用次数
    last_called = db.Column(db.DateTime)                 # 最后调用时间

class PageVisits(db.Model):
    __tablename__ = 'page_visits'
    
    id = db.Column(db.Integer, primary_key=True)
    page_name = db.Column(db.String(50), nullable=False) # 页面名称
    visit_count = db.Column(db.Integer, default=0)       # 访问次数
    last_visit = db.Column(db.DateTime)                  # 最后访问时间 